package com.iyundao.io.mapper;

import com.iyundao.io.tools.ActivityModelVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ActivityModelCustomMapper {

    @Select("select a.id,a.activitytitle,a.organizationid,a.activitynumber," +
            "DATE_FORMAT(a.activitystarttime,'%Y-%m-%d %H:%i:%s') activitystarttime," +
            "DATE_FORMAT(a.activityendtime,'%Y-%m-%d %H:%i:%s') activityendtime," +
            "a.activitysitename,a.activityflag,ac.categoryname,ac.categoryintegral " +
            "from activitymodel a " +
            "INNER JOIN activitycategory ac " +
            "on a.activityid= ac.id " +
            "where a.organizationid in ( " +
            "SELECT convert(sid,CHAR(36)) FROM sys_dept " +
            "where sid=(SELECT did from user_dept where uid = #{sid,jdbcType=CHAR}) " +
            "or " +
            "parent_id=(SELECT did from user_dept where uid = #{sid,jdbcType=CHAR}) " +
            ")")
    List<ActivityModelVo> selectUserId(String sid);
}
